<?php

class Bizprofile_Widgets_Mostviewed_Widget extends Tomato_Widget
{
    protected function _prepareShow()
    {
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $lang = $request->getParam('lang');
        $this->_view->assign('lang', $lang);
        $count = 6;

        /**
        * Get connection to database
        **/
        $conn = Tomato_Db_Connection::factory()->getMasterConnection();

        /**
        * Enterprise model access to data
        **/
        $enterpriseDao = Tomato_Model_Dao_Factory::getInstance()->setModule('enterprise')->getEnterpriseDao();
        $enterpriseDao->setDbConnection($conn);

        $enterprises = $enterpriseDao->getMostViewed($count);
        $this->_view->assign('enterprises', $enterprises);
    }

    protected function _prepareConfig()
    {

    }
}
